package com.fenghuajueli.libbasecoreui.utils;

import com.alibaba.android.arouter.launcher.ARouter;
import com.fenghuajueli.libbasecoreui.constants.FromConstant;
import com.fenghuajueli.module_route.UserModuleRoute;

public class RouteUtils {

    //传递过去的统计事件使用的事件id
    public static final String PARAMETER_FUN_TYPE = "PARAMETER_FUN_TYPE";
    //来自于哪个页面
    public static final String PARAMETER_FROM = "PARAMETER_FROM";
    //登录页面登录成功之后是否需要跳转过去
    public static final String PARAMETER_NEED_TO_VIP = "type";
    public static final String SHOULD_REFUND = "refund";



    /**
     * 跳转到开通vip界面
     */
    public static void routeToOpenVip() {
        ARouter.getInstance().build(UserModuleRoute.USER_OPEN_VIP_ACTIVITY).navigation();
    }

    /**
     * 跳转到开通vip界面，带一个来源参数 需要统计哪个页面跳转过去的
     */
    public static void routeToOpenVip(int funType) {
        ARouter.getInstance().build(UserModuleRoute.USER_OPEN_VIP_ACTIVITY)
                .withInt(PARAMETER_FUN_TYPE, funType)
                .navigation();
    }

    /**
     * 登录页跳转过去，多携带一个参数
     */
    public static void routeLoginToOpenVip(int funType) {
        ARouter.getInstance().build(UserModuleRoute.USER_OPEN_VIP_ACTIVITY)
                .withInt(PARAMETER_FUN_TYPE, funType)
                .withInt(PARAMETER_FROM, FromConstant.FROM_WITH_LOGIN)
                .navigation();
    }

    /**
     * 跳转到登录界面不带参数
     */
    public static void routeToLogin() {
        ARouter.getInstance().build(UserModuleRoute.USER_LOGIN).navigation();
    }
    /**
     * 跳转登录页面，登录成功之后判断是不是vip，不是就跳转到开通vip界面，带一个来源参数 需要统计哪个页面跳转过去的，
     */
    public static void routeToLogin(int funType) {
        ARouter.getInstance().build(UserModuleRoute.USER_LOGIN)
                .withInt(PARAMETER_FUN_TYPE, funType)
                .withString(PARAMETER_NEED_TO_VIP, "needToVip")
                .navigation();
    }


    /**
     * 登录成功跳转退款页
     */
    public static void routeToRefund() {
        ARouter.getInstance().build(UserModuleRoute.USER_LOGIN)
                .withBoolean(SHOULD_REFUND, true).navigation();
    }
}
